package marco.android.CouchControl;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import marco.android.CouchControl.R;

public class ModeSelectActivity extends Activity 
{	
	TextView mWiFiText;
	TextView mBTText;
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mode_selection_layout);
		
		mWiFiText = (TextView)findViewById(R.id.mode_selection_tcp_address_entry);
		//mWiFiText.setText("10.0.2.2");
		Button b = (Button) findViewById(R.id.mode_selection_network_go_button);
		b.setOnClickListener(new View.OnClickListener()
		{
			
			@Override
			public void onClick(View v)
			{
				// TODO Auto-generated method stub
				Intent i = new Intent(ModeSelectActivity.this, CouchControlActivity.class);
				i.putExtra("_mode", Connection.IOMode.eWiFi.ordinal());
				i.putExtra("_address", mWiFiText.getText());
				i.putExtra("_doGL",	false);
				startActivity(i);
			}
		});
		
		mBTText = (TextView)findViewById(R.id.mode_selection_bluetooth_address_entry);
		b = (Button) findViewById(R.id.mode_selection_bluetooth_go_button);
		b.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
//				Intent i = new Intent(ModeSelectActivity.this, GLActivity.class);
				Intent i = new Intent(ModeSelectActivity.this, CouchControlActivity.class);
//				i.putExtra("_mode", Connection.IOMode.eBluetooth.ordinal());
				i.putExtra("_mode", Connection.IOMode.eWiFi.ordinal());
				i.putExtra("_address", mBTText.getText());
				i.putExtra("_doGL", true);
				startActivity(i);
			}
		});
	}

}
